package com.dao;

import com.domain.Activity;
import org.apache.ibatis.annotations.*;

import java.lang.reflect.Array;
import java.util.ArrayList;

@Mapper
public interface ActivityDao {
    @Select("select * from tb_activity")
    ArrayList<Activity> findActivityAll();

    @Insert("insert into tb_activity" +
            "(title,category,startTime,endTime," +
            "remark,state,createdUser,createdTime)" +
            "values(#{title},#{category},#{startTime}," +
            "#{endTime},#{remark},#{state},#{createdUser}," +
            "now())")
    Integer insertActivity(Activity activity);

    @Delete("delete from tb_activity where id = #{id}")
    Integer deleteById(Integer id);


    @Update("update tb_activity set title=#{title},startTime=#{startTime},category=#{category},endTime=#{endTime} where id=#{id}")
    Integer updateById(Activity activity);


    @Select("select * from tb_activity where id = #{id}")
    Activity selectOne(Integer id);

}
